<?php

namespace App\Http\Requests\Admin\Menus;

use Illuminate\Foundation\Http\FormRequest;

class MenusCreate extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * 定义表单规则
     *
     * Date: 13/04/2018
     * @author Tenny
     * @return array
     */
    public function rules()
    {
        return [
            'code' => 'required',
            'parent_code' => 'required',
            'name' => 'required',
            'icon' => 'nullable',
            'uri' => 'nullable',
            'sort' => 'required',
            'status' => 'required',
        ];
    }

    /**
     * 定义错误响应消息
     *
     * Date: 13/04/2018
     * @author Tenny
     * @return array
     */
    public function messages()
    {
        return [
            'code.required' => '请输入标题',
            'parent_code' => '请输入父ID',
            'name.required' => '请输入名称',
            'sort.required' => '请输入排序',
            'status.required' => '请输入状态',
        ];
    }
}
